﻿using System;
using System.IO;
using SEXY;
using UnityEngine;

namespace Character
{
	// Token: 0x02000199 RID: 409
	public class ColorParameter_EyeHighlight : ColorParameter_Base
	{
		// Token: 0x06000ABE RID: 2750 RVA: 0x0003DFD0 File Offset: 0x0003C1D0
		public ColorParameter_EyeHighlight()
		{
		}

		// Token: 0x06000ABF RID: 2751 RVA: 0x0003E004 File Offset: 0x0003C204
		public ColorParameter_EyeHighlight(ColorParameter_EyeHighlight copy)
		{
			this.mainColor1 = copy.mainColor1;
			this.specColor1 = copy.specColor1;
			this.specular1 = copy.specular1;
			this.smooth1 = copy.smooth1;
		}

		// Token: 0x06000AC0 RID: 2752 RVA: 0x0003E074 File Offset: 0x0003C274
		public ColorParameter_EyeHighlight(Material material)
		{
			bool flag = ColorParameter_EyeHighlight.CheckGloss(material);
			this.specColor1 = material.GetColor(CustomDataManager._SpecColor);
			if (flag)
			{
				this.specular1 = material.GetFloat(CustomDataManager._Specular);
				this.smooth1 = material.GetFloat(CustomDataManager._Gloss);
			}
			else
			{
				this.mainColor1 = material.color;
			}
		}

		// Token: 0x06000AC1 RID: 2753 RVA: 0x0003E104 File Offset: 0x0003C304
		public override COLOR_TYPE GetColorType()
		{
			return COLOR_TYPE.EYEHIGHLIGHT;
		}

		// Token: 0x06000AC2 RID: 2754 RVA: 0x0003E108 File Offset: 0x0003C308
		public override void Save(BinaryWriter writer)
		{
			base.Save_ColorType(writer);
			base.WriteColor(writer, this.mainColor1);
			base.WriteColor(writer, this.specColor1);
			writer.Write(this.specular1);
			writer.Write(this.smooth1);
		}

		// Token: 0x06000AC3 RID: 2755 RVA: 0x0003E144 File Offset: 0x0003C344
		public override bool Load(BinaryReader reader, CUSTOM_DATA_VERSION version)
		{
			if (version < CUSTOM_DATA_VERSION.DEBUG_04)
			{
				base.ReadColor(reader, ref this.mainColor1);
				return true;
			}
			COLOR_TYPE color_TYPE = ColorParameter_Base.Load_ColorType(reader, version);
			if (color_TYPE == COLOR_TYPE.NONE)
			{
				return false;
			}
			if (color_TYPE != COLOR_TYPE.PBR1 && color_TYPE != this.GetColorType())
			{
				GlobalData.Debug_LogError("颜色类型不同");
			}
			base.ReadColor(reader, ref this.mainColor1);
			base.ReadColor(reader, ref this.specColor1);
			this.specular1 = reader.ReadSingle();
			this.smooth1 = reader.ReadSingle();
			return true;
		}

		// Token: 0x06000AC4 RID: 2756 RVA: 0x0003E1C8 File Offset: 0x0003C3C8
		public void FromSexyData(HSColorSet colorSet)
		{
			this.mainColor1 = colorSet.rgbaDiffuse;
			this.specColor1 = colorSet.rgbSpecular;
			this.specular1 = colorSet.specularIntensity;
			this.smooth1 = colorSet.specularSharpness;
		}

		// Token: 0x06000AC5 RID: 2757 RVA: 0x0003E1FC File Offset: 0x0003C3FC
		public override void SetToMaterial(Material material)
		{
			bool flag = ColorParameter_EyeHighlight.CheckGloss(material);
			if (flag)
			{
				material.SetFloat(CustomDataManager._Specular, this.specular1);
				material.SetFloat(CustomDataManager._Gloss, this.smooth1);
			}
			else
			{
				material.color = this.mainColor1;
			}
		}

		// Token: 0x06000AC6 RID: 2758 RVA: 0x0003E24C File Offset: 0x0003C44C
		public static bool CheckGloss(Material material)
		{
			return material != null && material.shader.name.IndexOf("glass") != -1;
		}

		// Token: 0x04000ABE RID: 2750
		public Color mainColor1 = Color.white;

		// Token: 0x04000ABF RID: 2751
		public Color specColor1 = Color.white;

		// Token: 0x04000AC0 RID: 2752
		public float specular1 = 1f;

		// Token: 0x04000AC1 RID: 2753
		public float smooth1 = 1f;
	}
}
